home *** CD-ROM | disk | FTP | other *** search
Text File | 1996-12-09 | 7.1 KB | 220 lines | [TEXT/CWIE] |
- {This file was processed by Dan's Source Converter}
- {version 1.3 (this version modified by Ingemar Ragnemalm)}
- {Cleaned up by Matthew Xavier Mora mxmora@apple.com}
-
- unit MP;
- interface
- uses
- Types, QuickDraw, Events, Windows, Dialogs, Fonts, DiskInit, TextEdit, Traps,{}
- Memory, SegLoad, Scrap, ToolUtils, OSUtils, Menus, Resources, StandardFile,{}
- GestaltEqu , Files , Errors , Devices , QuickDrawText , TextUtils,CodeFragments; {}
-
- {End of standard head. Add more units to uses as necessary.}
-
- (*}
- { MP.h}
- { Version 1.4 (AKA "Developer Release 27")}
- {}
- { Header file for the DayStar/Apple Multiprocessing API}
- { Friday, April 5, 1996 6:08:58 PM}
- {}
- { !! WARNING !!}
- { NAMES BEGINNING WITH "_MP" ARE NOT YET PART OF THE MP API.}
- { ANY APPLICATION CODE WHICH REFERENCES THESE NAMES IS LIKELY}
- { TO REQUIRE CHANGES WITH NEW RELEASES OF THE MP LIBRARY.}
- {*)
-
- {ifndef MP_h}
- {MP_h=;}
-
-
-
-
- {Block of #ifdef __cplusplus skipped here}
-
-
- const
- MPCopyrightNotice = 'Copyright © 1995, 1996 DayStar Digital, Inc.Portions Copyright © 1995 Apple Computer, Inc.\n';
-
- MPLibraryName = 'MPLibrary';
- MPLibraryCName = MPLibraryName;
- MPLibraryPName = MPLibraryName;
-
- MP_API_Version = '1.4';
- MPLibrary_MajorVersion = 1;
- MPLibrary_MinorVersion = 4;
- MPLibrary_Release = 0;
- MPLibrary_DevelopmentRevision = 27;
-
-
- type
- Duration = SInt32;
- ByteCount = UInt32;
- MPSemaphoreCount = UInt32;
- MPTaskOptions = UInt32;
-
- type
- TaskProc = function ( parameter:univ ptr) : OSStatus;
-
- type
- MPTaskID = longint ;{^_MPTaskID;}
-
- MPQueueID = longint ;{ ^_MPQueueID;}
- MPSemaphoreID = longint ;{ ^_MPSemaphoreID;}
- MPCriticalRegionID = longint ;{^_MPCriticalRegionID;}
-
- MPRemoteProcedure =procedure ( parameter:univ ptr);
-
- _MPPrintfHandler = procedure ( taskID : MPTaskID; const format:StringPtr ;va:Ptr );
- const
- NullTaskProc = nil;
- NullMPTaskID = nil;
- NullMPQueueID = nil;
- NullMPSemaphoreID = nil;
- NullMPCriticalRegionID = nil;
- NullMPRemoteProcedure = nil;
- Null_MPPrintfHandler = nil;
-
- const
-
- kMPNoID = nil;
-
- kMPUseDefaultStackSize = 0;
- kMPNormalTaskOptions = 0;
-
- { DEBUG: Ingen identifierare för enum }
- const
- kDurationImmediate = 0;
- kDurationForever = $7fffffff;
-
-
- {MPErrorValues }
- const
- kMPFirstError = -29299;
-
- kMPInvalidIDErr = kMPFirstError;
- kMPInsufficientResourcesErr = kMPFirstError+1;
- kMPTaskAbortedErr= kMPFirstError+2;
- kMPTimeoutErr= kMPFirstError+3;
- kMPDeletedErr= kMPFirstError+4;
-
- kMPAllocationFailed = kMPInsufficientResourcesErr;
- kMPInvalidTask = kMPInvalidIDErr;
- kMPInvalidQueue = kMPInvalidIDErr;
- kMPInvalidSemaphore = kMPInvalidIDErr;
- kMPInvalidCriticalRegion = kMPInvalidIDErr;
- kMPTaskDeleted = kMPDeletedErr;
- kMPQueueDeleted = kMPDeletedErr;
- kMPSemaphoreDeleted = kMPDeletedErr;
- kMPCriticalRegionDeleted = kMPDeletedErr;
-
- kMPBadEntryPoint = kMPDeletedErr +1;
- kMPUnrecognizedTaskCreationOptions = kMPDeletedErr +2;
- kMPInappropriateStackSize = kMPDeletedErr +3;
- kMPTaskDoesNotOwnCriticalRegion = kMPDeletedErr +4;
- kMPDurationValueNotYetSupported = kMPDeletedErr +5;
- kMPFunctionNotYetImplemented = kMPDeletedErr +6;
- kMPLibraryInternalInconsistencyError = kMPDeletedErr +7;
- kMPTaskSchedulerIsLocked = kMPDeletedErr +8;
-
- kMPFirstUnassignedErrorValue = kMPDeletedErr +9;
-
- kMPLastError = -29250;
-
- function MPCreateTask(entryPoint:TaskProc; parameter:univ ptr;
- stackSize:ByteCount;
- notifyQueue:MPQueueID;
- terminationParameter1:univ ptr;
- terminationParameter2:univ ptr ;
- options:MPTaskOptions;
- Var task:MPTaskID):OSStatus;
-
- function MPTerminateTask(task:MPTaskID; terminationStatus:OSStatus):OSStatus;
- function MPCreateQueue(Var queue:MPQueueID):OSStatus;
- function MPNotifyQueue(queue:MPQueueID; param1:univ ptr; param2:univ ptr;param3:univ ptr):OSStatus;
- function MPWaitOnQueue(queue:MPQueueID; param1:Ptr; param2:Ptr; param3:Ptr;timeout:Duration):OSStatus;
- function MPDeleteQueue(queue:MPQueueID):OSStatus;
- function MPCreateSemaphore(maximumValue:MPSemaphoreCount; initialValue:MPSemaphoreCount; Var semaphore:MPSemaphoreID):OSStatus;
- function MPSignalSemaphore(semaphore:MPSemaphoreID):OSStatus;
- function MPWaitOnSemaphore(semaphore:MPSemaphoreID; timeout:Duration):OSStatus;
- function MPDeleteSemaphore(semaphore:MPSemaphoreID):OSStatus;
- function MPCreateCriticalRegion(Var criticalRegion:MPCriticalRegionID):OSStatus;
- function MPEnterCriticalRegion(criticalRegion:MPCriticalRegionID; timeout:Duration):OSStatus;
- function MPExitCriticalRegion(criticalRegion:MPCriticalRegionID):OSStatus;
- function MPDeleteCriticalRegion(criticalRegion:MPCriticalRegionID):OSStatus;
-
- function MPCurrentTaskID:MPTaskID;
-
- function MPProcessors:UInt32;
- function _MPInitializationStatus:UInt32;
-
- function _MPIsFullyInitialized:Boolean;
- function _MPLibraryIsCompatible(api:StringPtr; major:UInt32; minor:UInt32; release:UInt32; revision:UInt32):Boolean;
-
- function _MPTaskIsToolboxSafe(task:MPTaskID):Boolean;
-
-
- function MPAllocate(size:ByteCount):LogicalAddress;
- function _MPAllocateSys(size:ByteCount):LogicalAddress;
-
- procedure MPFree(object:LogicalAddress);
- procedure MPBlockCopy(from:LogicalAddress; toAddr:LogicalAddress; blockSize:ByteCount);
- procedure MPYield;
- procedure MPExit(status:OSStatus);
- procedure _MPLibraryVersion(api:StringPtr;
- Var major:UInt32;
- Var minor:UInt32;
- Var release:UInt32;
- Var revision:UInt32);
-
- procedure _MPInitializePrintf(pfn:_MPPrintfHandler);
- procedure _MPPrintf( Var format:char; ...);
- procedure _MPDebugStr(s:StringPtr);
- procedure _MPRPC( procedure MPRemoteProcedure;parameter:univ ptr );
- function _MPStatusPString(status:OSStatus):StringPtr;
- function MPStatusCString( status:OSStatus):StringPtr;
-
- {Block of #ifdef __cplusplus skipped here}
-
-
- function MPCreateBinarySemaphore(semaphore:MPSemaphoreID):OSStatus;
- function MPLibraryIsLoaded: Boolean;
-
- implementation
-
- {--------------------------------------------------------------------------------------------------}
- function MPCreateBinarySemaphore(semaphore:MPSemaphoreID) :OSStatus;
- {--------------------------------------------------------------------------------------------------}
- begin
- MPCreateBinarySemaphore:=MPCreateSemaphore(1, 1, semaphore);
- end;
- {-------------------------------------------------------------}
- function MPLibraryIsLoaded: Boolean;
- {-------------------------------------------------------------}
- begin
- MPLibraryIsLoaded:=false;
- if longint(@_MPIsFullyInitialized) <> kUnresolvedCFragSymbolAddress then
- begin
- MPLibraryIsLoaded:=_MPIsFullyInitialized;
- end;
- end;
-
- {-------------------------------------------------------------}
- function MPLibraryIsCompatible: Boolean;
- {-------------------------------------------------------------}
- var
- tempStr:Str255;
- begin
- tempStr:=MP_API_Version;
-
- MPLibraryIsCompatible := _MPLibraryIsCompatible(@tempStr, MPLibrary_MajorVersion, MPLibrary_MinorVersion, MPLibrary_Release, MPLibrary_DevelopmentRevision);
-
- end;
-
-
-
- {delete the line above if the file is the main program}
-
- {Move it upwards if the unit is not an interface unit.}
- end.
-